import request from '@/utils/request'

export function businessPhoneIfRegisterApi (phone) {
  // 公司电话是否注册接口
  return request({
    url: '/api/business?phone=' + phone,
    method: 'GET'
  })
}

export function businessCodeIfRegisterApi (business_code) {
  // 公司代码是否注册接口
  return request({
    url: '/api/business?business_code=' + business_code,
    method: 'GET'
  })
}

export function businessNameIfRegisterApi (business_name) {
  // 公司名称是否注册接口
  return request({
    url: '/api/business?business_name=' + business_name,
    method: 'GET'
  })
}

export function businessListApi () {
  // 公司信息列表接口
  return request({
    url: '/api/business/',
    method: 'GET'
  })
}

export function businessCreateApi (data) {
  // 公司信息注册接口
  return request({
    url: '/api/business/',
    method: 'POST',
    data: data
  })
}

export function businessDeleteApi (business_id) {
  // 公司信息删除接口
  return request({
    url: '/api/business/' + business_id + '/',
    method: 'DELETE',
  })
}

export function businessUpdateApi (data) {
  // 公司信息更新接口
  return request({
    url: '/api/business/' + data['business_code'] + '/',
    method: 'PATCH',
    data: data
  })
}

export function businessDetailApi (business_id) {
  // 公司信息详细接口——单个公司信息
  return request({
    url: '/api/business/' + business_id + '/',
    method: 'GET',
  })
}
